'use strict';

var Model = require('../../model/mongo/ware.js');
var debug = require('debug')('ware');
let fout = require('../../common/function.js').formatOutput;

function MongoDao() {
    let self = this instanceof MongoDao ? this : new MongoDao();
    return self;
}
module.exports = MongoDao;
let theProto = MongoDao.prototype;

/**
 {
   "name":"xx",
   "cates":["美容","美发"],
   "districts":xxx,
   "loc":xxx
}
 * @param json
 * @returns {*}
 */

theProto.save = function*(json) {
    let entity = new Model(json);
    let result = yield entity.save()
    return fout(0, null, result._doc);
};
